package View;


import java.awt.Color;
import java.awt.Graphics;

/**
 *
 * @author p0904647
 */
@SuppressWarnings("serial")
public class Cell extends javax.swing.JPanel {

    /** Creates new form Case */
    private int i, j;
    private int form;

    public int getForm()
    {
        return form;
    }

    public void setForm(int form)
    {
        this.form = form;
    }

    public Cell(int i, int j) {
        initComponents();
        this.setBackground(Color.WHITE);
        this.i = i;
        this.j = j;
        this.form = 0;
    }

    public int getI() {
        return i;
    }

    public void setI(int i) {
        this.i = i;
    }

    public int getJ() {
        return j;
    }

    public void setJ(int j) {
        this.j = j;
    }
   

    public void drawCross(Graphics g)
    {
	g.setColor(Color.BLACK);
	g.drawLine(0, 0, this.getWidth(), this.getHeight());
	g.drawLine(0,this.getHeight(),  this.getWidth(), 0);

    }
    
    public void drawCircle(Graphics g)
    {  
       g.setColor(Color.BLACK);
       g.drawOval(0, 0, this.getWidth(), this.getHeight());
    }
 
    
    public void paintComponent(Graphics g)
    {
	super.paintComponent(g);

	switch(this.form)
	{
	case 1: this.drawCircle(g);
	break;
	case 2: this.drawCross(g);
	break;
	default : break;
	}
	
    }
                           
    private void initComponents() {

        setBackground(new java.awt.Color(51, 51, 51));
        setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 8, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 8, Short.MAX_VALUE)
        );
    }                    
}
